/*
 * @lc app=leetcode id=268 lang=cpp
 *
 * [268] Missing Number
 */
class Solution {
public:
    int missingNumber(vector<int>& nums) {
        int len = nums.size();
        int res = len;
        for (int i=0; i<len; i++) {
            res ^= i;
            res ^= nums[i];
        }
        return res;
        
    }
};

